﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Xml;

namespace simpleGUI_QLQTPM
{
	public partial class Form_ChiTietDichVu : Form
	{
		public Form_ChiTietDichVu()
		{
			InitializeComponent();
		}
		private string _kinhDo = "";

		public string KinhDo
		{
			get { return _kinhDo; }
			set { _kinhDo = value; }
		}
		private string _viDo = "";

		public string ViDo
		{
			get { return _viDo; }
			set { _viDo = value; }
		}

		private string _tenDuLieu = "";

		public string TenDuLieu
		{
			get { return _tenDuLieu; }
			set { _tenDuLieu = value; }
		}

		public void SetInformation(string strTenDiaDiem, string strDiaChi, string strLoai, string strKinhDo, string strVido, string strGhiChu)
		{
			if (null == strTenDiaDiem || null == strDiaChi || null == strLoai || null == strKinhDo || null == strVido || null == strGhiChu)
			{
				return;
			}

			try
			{
				this.GB_TenDichVu.Text = strLoai;
				this.lblTenDichVu.Text = strTenDiaDiem;
				this.lblDiaChi.Text = strDiaChi;
				this.lblChuThich.Text = strGhiChu;
				this.KinhDo = strKinhDo;
				this.ViDo = strVido;
				this.TenDuLieu = strTenDiaDiem;

				if (!File.Exists("config.xml"))
				{
					//MessageBox.Show("Bạn chưa cấu hình đường dẫn tới thư mục bản đồ trong tập tin config.ini. Vui lòng xem hướng dẫn.");
				}
				else
				{
					string tenThuMuc = "";
					try
					{
						XmlDocument document = new XmlDocument();
						document.Load("config.xml");

						XmlElement root = document.DocumentElement;
						XmlElement element = (XmlElement)root.SelectSingleNode("//MAP/PATH");

						tenThuMuc = element.InnerText;

						this.PB_Map.Image = Image.FromFile(tenThuMuc + "/" + strVido + "_" + strKinhDo + ".png");

					}
					catch (Exception e)
					{
						//MessageBox.Show(e.Message);
					}
				}
				//  this.PB_Map.Image = Image.FromFile("BanDo/"+strVido+"_"+strKinhDo+".png");
			}
			catch (System.Exception ex)
			{

			}
		}

		private void btn_MapOnline_Click(object sender, EventArgs e)
		{
			GetLocation form = new GetLocation();
			form.KinhDo = this.KinhDo;
			form.ViDo = this.ViDo;
			form.TenDuLieu = TenDuLieu;
			form.ShowDialog();

		}
		bool expanded = false;
		private void pictureBox1_Click(object sender, EventArgs e)
		{
			if (expanded == false)
			{
				this.Size = new System.Drawing.Size(649, 862);
				//((PictureBox)(sender)).Location = new Point(967,131);
				((PictureBox)(sender)).BackgroundImage = global::simpleGUI_QLQTPM.Properties.Resources.Up;
				expanded = true;
			}
			else
			{
				this.Size = new System.Drawing.Size(649, 378);
				// ((PictureBox)(sender)).Location = new Point(628,131);
				((PictureBox)(sender)).BackgroundImage = global::simpleGUI_QLQTPM.Properties.Resources.Down;
				expanded = false;
			}

		}

		private void Button_Tim_MouseEnter(object sender, EventArgs e)
		{
			Panel_Tim.BackgroundImage = simpleGUI_QLQTPM.Properties.Resources.staticbutton6_hover;
		}

		private void Button_Tim_MouseLeave(object sender, EventArgs e)
		{
			Panel_Tim.BackgroundImage = simpleGUI_QLQTPM.Properties.Resources.staticbutton6;
		}


	}
}
